package org.exam;

import org.exam.util.StringUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

public class Testing {
    public static void main(String[] args) {


        List<String> testStrList = new ArrayList<>();
        testStrList.add("D");
        testStrList.add("B");
        testStrList.add("     ");
        testStrList.add("");
        testStrList.add(null);
        System.out.println(testStrList);
//        List<String> collect1 = testStrList.stream().filter(item -> !Boolean.parseBoolean(item) || !("D".equals(item.trim()) || "B".equals(item.trim())) ).collect(Collectors.toList());
//        List<String> collect2 = testStrList.stream().filter(item -> StringUtils.isNotBlank(item) || !("D".equals(item.trim()) || "B".equals(item.trim())) ).collect(Collectors.toList());
//        List<String> collect3 = testStrList.stream().filter(item -> StringUtils.isBlank(item.trim()) || !("D".equals(item.trim()) || "B".equals(item.trim())) ).collect(Collectors.toList());
        List<String> collect4 = testStrList.stream().filter(item -> StringUtils.isEmpty(item) || StringUtils.isBlank(item.trim()) || !("D".equals(item.trim()) || "B".equals(item.trim())) ).collect(Collectors.toList());
        List<String> collect5 = testStrList.stream().filter(item -> Objects.isNull(item) || StringUtils.isBlank(item.trim()) || !("D".equals(item.trim()) || "B".equals(item.trim())) ).collect(Collectors.toList());

//        System.out.println(collect1 + ": " + collect1.size());
//        System.out.println(collect2 + ": " + collect2.size());
//        System.out.println(collect3 + ": " + collect3.size());
        System.out.println(collect4 + ": " + collect4.size());
        System.out.println(collect5 + ": " + collect5.size());

        List<String> test = new ArrayList<>();
        test.add("");
        test.add("U");
        test.add("U");

        List<String> collect = test.stream().filter(item -> Objects.isNull(item) || StringUtils.isBlank(item.trim()) || !("D".equals(item.trim()) || "B".equals(item.trim())) ).collect(Collectors.toList());
        System.out.println("collect = " + collect);
    }
}
